{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from PIL import Image, ImageDraw, ImageFont\n",
    "from IPython.display import display\n",
    "\n",
    "# Open the image file\n",
    "image = Image.open('obtainable_supports/Chang the Ninth.png')\n",
    "\n",
    "\n",
    "# Define the font and text to draw\n",
    "font = ImageFont.truetype('/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf', 72)\n",
    "\n",
    "# Get the size of the text\n",
    "# text_width, text_height = draw.textsize(text, font=font)\n",
    "\n",
    "# Calculate the position of the text\n",
    "# x = (image.width - text_width) / 2\n",
    "# y = (image.height - text_height) / 2\n",
    "x = 100\n",
    "y = 130\n",
    "\n",
    "color = {\n",
    "    'Dendro Mob': [81, 129, 14],\n",
    "    'Anemo Mob': [38, 166, 132],\n",
    "    'Hydro Mob': [11, 77, 218],\n",
    "    'Electro Mob': [147, 54, 176],\n",
    "    'Geo Mob': [182, 141, 7],\n",
    "    'Cryo Mob': [71, 120, 168],\n",
    "    'Pyro Mob': [191, 40, 24],\n",
    "    'Physical Mob': [0, 0, 0],\n",
    "}\n",
    "\n",
    "border_color = (255, 255, 255, 255)\n",
    "\n",
    "for key in color:\n",
    "    # Draw the text on the image\n",
    "    text = key.replace(' ', '\\n')\n",
    "    c = tuple(color[key] + [255])\n",
    "    # Create a Draw object\n",
    "    ii = image.copy()\n",
    "    draw = ImageDraw.Draw(ii)\n",
    "    border_thickness = 2\n",
    "    bbox = draw.textbbox((0, 0), text, font=font)\n",
    "    length = bbox[2]\n",
    "    x = (image.width - length) / 2\n",
    "    for i in range(1, border_thickness + 1):\n",
    "        draw.text((x - i, y), text, font=font, fill=border_color)\n",
    "        draw.text((x + i, y), text, font=font, fill=border_color)\n",
    "        draw.text((x, y - i), text, font=font, fill=border_color)\n",
    "        draw.text((x, y + i), text, font=font, fill=border_color)\n",
    "    draw.text((x, y), text, font=font, fill=c)\n",
    "    display(ii.convert('RGB'))\n",
    "    ii.save(f'custom/{key}.png')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from PIL import Image, ImageDraw, ImageFont\n",
    "from IPython.display import display\n",
    "\n",
    "# Open the image file\n",
    "image = Image.open('obtainable_supports/Hanachirusato.png')\n",
    "\n",
    "\n",
    "# Define the font and text to draw\n",
    "font = ImageFont.truetype('/usr/share/fonts/truetype/ubuntu/Ubuntu-B.ttf', 72)\n",
    "\n",
    "# Get the size of the text\n",
    "# text_width, text_height = draw.textsize(text, font=font)\n",
    "\n",
    "# Calculate the position of the text\n",
    "# x = (image.width - text_width) / 2\n",
    "# y = (image.height - text_height) / 2\n",
    "x = 100\n",
    "# y = 70\n",
    "y = 130\n",
    "\n",
    "color = {\n",
    "    'Dendro Mob Mage': [81, 129, 14],\n",
    "    'Anemo Mob Mage': [38, 166, 132],\n",
    "    'Hydro Mob Mage': [11, 77, 218],\n",
    "    'Electro Mob Mage': [147, 54, 176],\n",
    "    'Geo Mob Mage': [182, 141, 7],\n",
    "    'Cryo Mob Mage': [71, 120, 168],\n",
    "    'Pyro Mob Mage': [191, 40, 24],\n",
    "}\n",
    "\n",
    "border_color = (255, 255, 255, 255)\n",
    "\n",
    "for key in color:\n",
    "    # Draw the text on the image\n",
    "    text = key.replace(' ', '\\n')\n",
    "    c = tuple(color[key] + [255])\n",
    "    # Create a Draw object\n",
    "    ii = image.copy()\n",
    "    draw = ImageDraw.Draw(ii)\n",
    "    border_thickness = 2\n",
    "    bbox = draw.textbbox((0, 0), text, font=font)\n",
    "    length = bbox[2]\n",
    "    x = (image.width - length) / 2\n",
    "    for i in range(1, border_thickness + 1):\n",
    "        draw.text((x - i, y), text, font=font, fill=border_color)\n",
    "        draw.text((x + i, y), text, font=font, fill=border_color)\n",
    "        draw.text((x, y - i), text, font=font, fill=border_color)\n",
    "        draw.text((x, y + i), text, font=font, fill=border_color)\n",
    "    draw.text((x, y), text, font=font, fill=c)\n",
    "    display(ii.convert('RGB'))\n",
    "    ii.save(f'custom/{key}.png')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "GITCG",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
